import java.util.Scanner;
public class PTB2 {
	public static void main(String[] args) {
		double a, b, c, delta, x1, x2;
		Scanner scan = new Scanner(System.in);
		String menu = "";
		do {
			System.out.print("Enter the number a: ");
			a = scan.nextDouble();
			System.out.print("Enter the number b: ");
			b = scan.nextDouble();
			System.out.print("Enter the number c: ");
			c = scan.nextDouble();

			delta = (b * b) - (4 * a * c);
			;
			if (a != 0) {
				if (delta > 0) {

					System.out.println("Phuong trinh co 2 nghiem !");
					x1 = ((-b) - Math.sqrt(delta)) / (2 * a);
					x2 = ((-b) + Math.sqrt(delta)) / (2 * a);
					System.out.println("x1 = " + x1);
					System.out.println("x2 = " + x2);
				} else {
					if (delta == 0) {
						System.out.println("Phuong trinh co nghiem kep !");
						x1 = x1 = (-b) / (2 * a);
						System.out.println("x1 = x2 = " + x1);
					} else if (delta < 0) {
						System.out.println("Phuong trinh vo nghiem");
					}

				}
			}
			else
				if(b!=0)
				{	x1=-b/c;
				System.out.println("x= "+x1);
				}
				else
					if(c!=0)
						System.out.println("Phuong trinh vo nghiem !");
					else System.out.println("Phuong trinh vo so nghiem !");
		
			System.out.print("Do you want to continue ( yes/no): ");
			scan.nextLine();
			menu = scan.nextLine();
		} while (menu.equalsIgnoreCase("yes") == true);
	}
}
